/**
 * GET home page.
 */

exports.index = function(req, res) {
    "use strict";
    res.render("jindex", {
        title : "Ocean Manager System",
        footer:"Copyright 2014 XL International",
        header:"Ocean Manager System (ver: 0.1)"
    });
};

/**
 * export all js files in 'routes' directory. all function used exports in these
 * files now can be access through routes.xxx form.
 */
function exportAll() {
    "use strict";
    var fs = require("fs");
    var files = fs.readdirSync("routes");
    files.forEach(function(fileName) {
        if (fileName !== "index.js") {
            var localExports = require("./" + fileName);
            for ( var k in localExports) {
                if (localExports.hasOwnProperty(k)) {
                    exports[k] = localExports[k];
                }
            }
        }
    });
}

exportAll();
